package com.atsmart.app.model;

import java.io.Serializable;
import java.util.Comparator;

import com.atsmart.app.utils.StringUtil;
import com.google.json.annotations.SerializedName;

public class MessageInfo implements Serializable,Comparator{

	/**
	 *
	 */
	private static final long serialVersionUID = 6588231403283129377L;

	@SerializedName("message-id")
	private String id;
	@SerializedName("title")
	private String title;
	
	@SerializedName("sender")
	private String sender;
	@SerializedName("content")
	private String content;
	@SerializedName("date")
	private String date;
	
	@SerializedName("sticky")
	private int sticky;
	
	@SerializedName("days")
	private int days ;
	
	@SerializedName("file-flg")
	private int file_flg ;
	
	

	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public int getSticky() {
		return sticky;
	}
	public void setSticky(int sticky) {
		this.sticky = sticky;
	}
	public int getDays() {
		return days;
	}
	public void setDays(int days) {
		this.days = days;
	}
	public int getFile_flg() {
		return file_flg;
	}
	public void setFile_flg(int file_flg) {
		this.file_flg = file_flg;
	}
	@SerializedName("receive-flag")
	private String receiveFlag;
	@SerializedName("read-flag")
	private String readFlag;
	@SerializedName("type")
	private int type;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getSender() {
		return sender;
	}
	public void setSender(String sender) {
		this.sender = sender;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public String getReceiveFlag() {
		return receiveFlag;
	}
	public void setReceiveFlag(String receiveFlag) {
		this.receiveFlag = receiveFlag;
	}
	public String getReadFlag() {
		return readFlag;
	}
	public void setReadFlag(String readFlag) {
		this.readFlag = readFlag;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getType() {
		return type;
	}
	@Override
	public int compare(Object arg0, Object arg1) {
		// TODO Auto-generated method stub
		MessageInfo user0=(MessageInfo)arg0;
		MessageInfo user1=(MessageInfo)arg0;

		   //首先比较年龄，如果年龄相同，则比较名字
	   if(	user0.getSticky()==user1.getSticky())
	   {
		   int a=(int) (StringUtil.FormDateToTime(user0.getDate())-StringUtil.FormDateToTime(user0.getDate()));
		   return a;
	   }
	   else
	   {
		  return  user0.getSticky()-user1.getSticky();
	   }
		  

	}
}
